package com.pennywise.controller;

import com.pennywise.common.response.Result;
import com.pennywise.model.SavingPlan;
import com.pennywise.service.SavingPlanService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "存钱计划")
@RestController
@RequestMapping("/api/saving-plan")
@RequiredArgsConstructor
public class SavingPlanController {
    
    private final SavingPlanService savingPlanService;
    
    @Operation(summary = "获取存钱计划")
    @GetMapping
    public Result<SavingPlan> getSavingPlan() {
        return Result.success(savingPlanService.calculateSavingPlan());
    }
    
    @Operation(summary = "获取消费分析")
    @GetMapping("/spending-analysis")
    public Result<String> getSpendingAnalysis() {
        return Result.success(savingPlanService.analyzeMonthlySpending());
    }
} 